<?php

class ImageCategory extends CActiveRecord
{
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}

	public function tableName()
	{
		return '{{image_category}}';
	}

	public function rules()
	{
		return array(
			array('file_id, cat_id', 'required'),
			array('file_id, cat_id', 'numerical', 'integerOnly'=>true),
			array('id, file_id, cat_id', 'safe', 'on'=>'search'),
		);
	}

	public function relations()
	{
		return array(
		);
	}

	public function attributeLabels()
	{
		return array(
			'id' => 'ID',
			'file_id' => 'File',
			'cat_id' => 'Dir',
		);
	}

	public function search()
	{
		$criteria=new CDbCriteria;

		$criteria->compare('id',$this->id);
		$criteria->compare('file_id',$this->file_id);
		$criteria->compare('cat_id',$this->dir_id);

		return new CActiveDataProvider($this, array(
			'criteria'=>$criteria,
		));
	}

    public function getFileId()
    {
        return $this->file_id;
    }

    public function getCatId()
    {
        return $this->cat_id;
    }
}